<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/catethanh.css" />
<div class="box">
  <div class="box-heading"><?php echo $heading_title; ?></div>
  <div class="box-content">
    <div class="product">  
                    <?php $thanhntt89 = 0;foreach ($products as $product) { $thanhntt89 ++;?>
                    <?php if ($product['thumb']) { ?>
                    <?php if($thanhntt89%5 == 1){?><ul class="product-item"><?php }?>
                    <li <?php if($thanhntt89%5 == 1){echo 'class="item-first"'; }?>>
                        <div class="avata"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
                        <?php } ?>
                        <div class="name"><a href="<?php echo $product['href']; ?>"><span><?php echo $product['name']; ?></span></a></div>      
                        <?php if ($product['price']) { ?>
                        <?php if (!$product['special']) { ?>
                        <div class="price" ><?php echo $product['price']; ?></div>
                        <div class="empty">&nbsp;</div>
                        <?php } else { ?>
                        <div class="price"><?php echo $product['special']; ?></div>
                        <div class="old-price"><?php echo $product['price']; ?></div>
                        <?php } ?>
                        <?php } ?>
                        <div class="btn">
                            <input type="text" class="qtty" name="quantity" size="2" />
                            <input type="hidden" name="product_id" size="2" value="<?php echo $product['product_id']; ?>" />
                            <input class="btn-b" type="button" />                        </div>
                    </li>
                    <?php if($thanhntt89%5 == 0){?></ul><?php }?>
                    <?php } ?>
                </div>
  </div>
</div>
<script type="text/javascript">
    $('.btn-b').bind('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/update',
		type: 'post',
		data: $(this).parent().find('input[type=\'text\'], input[type=\'hidden\']'),
		dataType: 'json',
		success: function(json) {
			$('.success, .warning, .attention, information, .error').remove();
			
			if (json['error']) {
				if (json['error']['warning']) {
					$('#notification').html('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
				
					$('.warning').fadeIn('slow');
				}
				
				for (i in json['error']) {
					$('#option-' + i).after('<span class="error">' + json['error'][i] + '</span>');
				}
			}	 
						
			if (json['success']) {
				$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
					
				$('.success').fadeIn('slow');
					
				$('#cart_total').html(json['total']);
				
				$('html, body').animate({ scrollTop: 0 }, 'slow'); 
			}	
		}
	});
});
</script>